<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./PrincipalTemplate.xhtml">

            <ui:define name="top">
                top
            </ui:define>

            <ui:define name="left">
                left
            </ui:define>

            <ui:define name="content">
                <f:view>
                    <h:form>
                        <h1><h:outputText value="Create Sale Details"/></h1>
                        <h:panelGrid columns="2">
                            <h:outputLabel value="IdsailDetail:" for="idsailDetail" />
                            <h:inputText id="idsailDetail" value="#{saleDetailsBean.saleDetail.idsailDetail}" title="IdsailDetail" required="true" requiredMessage="The IdsailDetail field is required."/>
                            <h:outputLabel value="Amount:" for="amount" />
                            <h:inputText id="amount" value="#{saleDetailsBean.saleDetail.amount}" title="Amount" required="true" requiredMessage="The Amount field is required."/>
                            <h:outputLabel value="LineTotal:" for="lineTotal" />
                            <h:inputText id="lineTotal" value="#{saleDetailsBean.saleDetail.lineTotal}" title="LineTotal" required="true" requiredMessage="The LineTotal field is required."/>
                            <h:outputLabel value="IdDisc:" for="idDisc" />
                            <p:panelGrid columns="3">
                            <h:selectOneMenu id="idDisc" value="#{saleDetailsBean.saleDetail.idDisc}" title="IdDisc" required="true" requiredMessage="The IdDisc field is required.">
                                <!-- TODO: update below reference to list of available items-->
                                <f:selectItems value="#{discsBean.disc}" var="item" itemLabel="#{item.nombre}" itemValue="#{item.id}"/>
                            </h:selectOneMenu>
                                <p:commandButton value="Add" actionListener="#{saleDetailsBean.agregarDisco}"/>
                            </p:panelGrid>
                            <p:commandButton value="Register" action="#{saleDetailsBean.processAction()}" ajax="false"/>
                            <p:commandButton value="Cancel" immediate="true" action="" ajax="false"/>
                        </h:panelGrid>
                    </h:form>
                </f:view>


            </ui:define>

        </ui:composition>

    </body>
</html>
